$(function () {
    //焦点图模板渲染
    gitInfo(BigNews.index_hotpic, '.focus_list', 'focus-img', function () {
        $('.focus_list li:eq(0)').addClass('first')
    })
    //最新资讯模板渲染
    gitInfo(BigNews.index_latest, '.common_news', 'new-list')
    //热门模板渲染
    gitInfo(BigNews.index_rank, '.hotrank_list', 'hot-list', function () {
        $('.hotrank_list>li:eq(0)').find('span').addClass('first')
        $('.hotrank_list>li:eq(1)').find('span').addClass('second')
        $('.hotrank_list>li:eq(2)').find('span').addClass('third')
    })
    //最新评论模板渲染
    gitInfo(BigNews.index_latest_comment, '.comment_list', 'new-latest')
    //焦点关注模板渲染
    gitInfo(BigNews.index_attention, '.guanzhu_list', 'guanzhu-list')

    function gitInfo(url, str, id, fn) {
        $.ajax({
            url: url,
            type: 'get',
            dataType: 'json',
            success: function (backData) {
                // console.log(backData);
                $(str).html(template(id, backData))
                if (typeof fn == 'function') {
                    fn()
                }
            }
        })
    }
})